package top.superflow.version.structure

import top.superflow.db.api.DBSchema
import top.superflow.exception.RequestUnsupportedException
import top.superflow.version.db.data.DBEntityVersion

class DBStructure(originalDBSchema : Any) extends Structure {

  originalDBSchema match {
    case dbSchema : DBSchema =>{
      for((entityName, entity) <- dbSchema.entityMaps){
        val dbEntityVersion = new DBEntityVersion(entity)
        entityVersions += (entityName -> dbEntityVersion)
      }
    }
    case _ => {
      throw new RequestUnsupportedException("Only DBSchema is supported")
    }
  }

  def getId: String = {
    "dbStructure"
  }
}
